<?php
session_start();

set_include_path(
    dirname(__FILE__) . PATH_SEPARATOR . get_include_path()
);

require_once 'OpenID/Consumer.php';
require_once 'OpenID/Store/File.php';

$store = new OpenID_Store_File(dirname(__FILE__));
$test = new OpenID_Consumer($store);

if (isset($_GET) && !empty($_GET)) {
    var_dump($_GET); var_dump($_SESSION);
    echo '<hr>';
    $result = $test->finish($_GET);
    var_dump($result);
    exit;
}

OpenID::setVersion(2.0);
$authRedirect = $test->start('padraic.astrumfutura.com');
//var_dump($test); exit;
$authRedirect->setExtensionArgument('sreg', 'optional', 'email');
//exit($authRedirect->getRedirectUri('http://localhost/projects/openid/test.php', 'http://localhost'));
$authRedirect->redirect('http://localhost/projects/pear/trunk/OpenID/test.php', 'http://localhost');